package com.ruicar.afs.cloud.basic.common.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruicar.afs.cloud.basic.common.entity.BasicDebitInfo;
import com.ruicar.afs.cloud.basic.common.entity.BasicMainInfo;
import com.ruicar.afs.cloud.basic.common.service.BasicDebitInfoService;
import com.ruicar.afs.cloud.common.core.util.IResponse;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: Lee
 * @date: 2020/5/11 19:39
 * @description: 借据表信息操作controller
 */
@Slf4j
@RestController
@RequestMapping("/basicDebitInfo")
@AllArgsConstructor
public class BasicDebitInfoController {

    private final BasicDebitInfoService basicDebitInfoService;

    @ApiOperation(value = "根据合同号码查询合同信息")
    @PostMapping("/findByContractNo")
    public IResponse<BasicDebitInfo> findByContractNo(@RequestParam("contractNo") String contractNo) {
        BasicDebitInfo basicDebitInfo = basicDebitInfoService.getOne(Wrappers.<BasicDebitInfo>lambdaQuery().eq(BasicDebitInfo::getContractNo, contractNo));
        return new IResponse<BasicDebitInfo>().setData(basicDebitInfo);
    }
}
